#!/bin/sh

function s1_hello()
{
        echo "hello,world!"
}

function s2_tell_who_i_am()
{
        echo "$(whoami)"
}

function s3_which_distro_do_i_use()
{
        if [ -f /etc/os-release ]; then
          . /etc/os-release
          echo "NAME=\"$NAME\""
        elif [ -f /etc/redhat-relaese ]; then
          DISTRO=$(cat /etc/redhat-release)
          echo "NAME=\"$(echo $DISTRO | awk '{print $1}')\""
         else
         echo "NAME=\"没有发现版本信息!\""
         fi
}

function s4_view_my_cpu_arh()
{
        local cpu_arch=$(uname -m)
        case "$cpu_arch" in
        x84_64 | amd64)
        echo "x84_64"
        ;;
        *)
        echo "未能识别CPU:$cpu_arch"
        ;;
        esac
}

function s5_show_main_memory_size_in_megabytes()
{
        disk_size_gb=$(lsblk -bno SIZE /dev/sd? --exclude 1 | tail -n +2 | awk 'NR==1{print $1/1024/1024/1024}')
        echo -n "${disk_size_gb%.*}"
}

function s6_show_main_memory_size_in_megabytes()
{
        free -m | grep "Mem:" | awk '{print $2}'
}
